package com.yangcangclub.system.domain;

import com.yangcangclub.system.base.SystemBaseDomain;
import com.google.common.collect.Maps;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * 个人推送配置
 */
@Component
public class PushConfig extends SystemBaseDomain {


    /**
     * 查询个人配置list
     */
    public List<Map<String,Integer>> queryConflist(int userId){
        return super.getSlaveJdbc().selectList("system.SystemMapper.selectPushconfList", userId);
    }

    /**
     * 新增个人配置
     */
    public boolean addPushConf(int userId, int pushType,int state){
        Map<String,Integer>map= Maps.newHashMap();
        map.put("user_id",userId);
        map.put("push_type",pushType);
        map.put("state",state);
        return 1==super.getMasterJdbc().insert("system.SystemMapper.insertPushConf", map);
    }


    /**
     * 修改个人配置
     */
    public boolean updatePushConf(int userId, int pushType,int state){
        Map<String,Integer>map= Maps.newHashMap();
        map.put("user_id",userId);
        map.put("push_type",pushType);
        map.put("state",state);
        return 1==super.getMasterJdbc().update("system.SystemMapper.updatePushConf", map);
    }



}

